//
//  RepairViewCell.swift
//  hunan_ios_ldnydfuz
//
//  Created by yzd on 2019/5/16.
//  Copyright © 2019 ldnsm. All rights reserved.
//

import UIKit

class RepairViewCell: UITableViewCell {
    var index :Int = 0
    var id :Int = 0
    @IBOutlet weak var name: UILabel!
    @IBOutlet weak var num: UILabel!
    public var addTap: ((Int,Int) -> Void)? = nil
    public var reduceTap: ((Int,Int) -> Void)? = nil
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    @IBAction func reduce(_ sender: UIButton) {
         reduceTap?(id,index)
    }
    @IBAction func add(_ sender: UIButton) {
        addTap?(id,index)
    }
    var model: RepairDetail? {
        didSet {
            guard let model = model else { return }
            name.text = model.repairName
            num.text = "\(model.number)"
            id = model.id
        }
    }
}
